﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Media;

namespace DoAnHuongRung
{
    public partial class frmMain : Form
    {
        public frmMain()
        {
            InitializeComponent();
        }

        private void frmMain_FormClosed(object sender, FormClosedEventArgs e)
        {

            Application.Exit();
        }

        private void frmMain_Load(object sender, EventArgs e)
        {
        }

        private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            SoundPlayer s = new SoundPlayer(Properties.Resources.Windows_Logoff_Sound);
            s.Play();
        }

        private void nhàCungCấpToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form form in this.MdiChildren)
            {
                if (form.Name.Equals("frmNhaCungCap"))
                {
                    form.BringToFront();
                    return;
                }
            }

            frmNhaCungCap frm = new frmNhaCungCap();
            frm.MdiParent = this;
            frm.Show();
        }

        private void lậpĐơnĐặtHàngToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form form in this.MdiChildren)
            {
                if (form.Name.Equals("frmLapDonDatHang"))
                {
                    form.BringToFront();
                    return;
                }
            }

            frmLapDonDatHang frm = new frmLapDonDatHang();
            frm.MdiParent = this;
            frm.Show();
        }

        private void nguyênVậtLiệuToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form form in this.MdiChildren)
            {
                if (form.Name.Equals("frmNguyenVatLieu"))
                {
                    form.BringToFront();
                    return;
                }
            }

            frmNguyenVatLieu frm = new frmNguyenVatLieu();
            frm.MdiParent = this;
            frm.Show();
        }

        private void mónĂnToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form form in this.MdiChildren)
            {
                if (form.Name.Equals("frmMonAn"))
                {
                    form.BringToFront();
                    return;
                }
            }

            frmMonAn frm = new frmMonAn();
            frm.MdiParent = this;
            frm.Show();
        }

        private void loạiMónĂnToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form form in this.MdiChildren)
            {
                if (form.Name.Equals("frmLoaiMonAn"))
                {
                    form.BringToFront();
                    return;
                }
            }

            frmLoaiMonAn frm = new frmLoaiMonAn();
            frm.MdiParent = this;
            frm.Show();
        }

        private void nhậpKhoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form form in this.MdiChildren)
            {
                if (form.Name.Equals("frmNhapKhoNVL"))
                {
                    form.Close();
                }
            }

            frmNhapKhoNVL frm = new frmNhapKhoNVL();
            frm.MdiParent = this;
            frm.Show();
        }

        private void thôngTinToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form form in this.MdiChildren)
            {
                if (form.Name.Equals("frmQuanLyNhanVien"))
                {
                    form.Close();
                }
            }

            frmQuanLyNhanVien frm = new frmQuanLyNhanVien();
            frm.MdiParent = this;
            frm.Show();
        }

        private void lậpLịchLàmViệcToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form form in this.MdiChildren)
            {
                if (form.Name.Equals("frmLapLichLamViec"))
                {
                    form.Close();
                }
            }

            frmLapLichLamViec frm = new frmLapLichLamViec();
            frm.MdiParent = this;
            frm.Show();
        }

        private void thựcĐơnToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form form in this.MdiChildren)
            {
                if (form.Name.Equals("frmThucDoc"))
                {
                    form.BringToFront();
                    return;
                }
            }

            frmThucDon frm = new frmThucDon();
            frm.MdiParent = this;
            frm.Show();
        }
    }
}
